Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

libsodium-wrappers-sumo

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libsodium-wrappers-sumo

The Sodium cryptographic library compiled to pure JavaScript (wrappers, sumo variant)

  • 0.7.15
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is libsodium-wrappers-sumo?

libsodium-wrappers-sumo is a JavaScript wrapper for the Sodium cryptographic library, providing a wide range of cryptographic operations. It includes additional features from the 'sumo' variant of libsodium, which offers extended functionalities beyond the standard libsodium library.

What are libsodium-wrappers-sumo's main functionalities?

Symmetric Encryption

This feature allows you to encrypt a message using symmetric encryption. The code generates a random key and nonce, then encrypts the message 'Hello, World!' using the crypto_secretbox_easy function.

const sodium = require('libsodium-wrappers-sumo');
(async() => {
  await sodium.ready;
  const key = sodium.crypto_secretbox_keygen();
  const nonce = sodium.randombytes_buf(sodium.crypto_secretbox_NONCEBYTES);
  const message = 'Hello, World!';
  const ciphertext = sodium.crypto_secretbox_easy(message, nonce, key);
  console.log({ nonce, ciphertext });
})();

Asymmetric Encryption

This feature allows you to encrypt a message using asymmetric encryption. The code generates a key pair, a random nonce, and then encrypts the message 'Hello, World!' using the crypto_box_easy function.

const sodium = require('libsodium-wrappers-sumo');
(async() => {
  await sodium.ready;
  const { publicKey, privateKey } = sodium.crypto_box_keypair();
  const nonce = sodium.randombytes_buf(sodium.crypto_box_NONCEBYTES);
  const message = 'Hello, World!';
  const ciphertext = sodium.crypto_box_easy(message, nonce, publicKey, privateKey);
  console.log({ nonce, ciphertext });
})();

Hashing

This feature allows you to hash a message. The code hashes the message 'Hello, World!' using the crypto_generichash function, producing a 32-byte hash.

const sodium = require('libsodium-wrappers-sumo');
(async() => {
  await sodium.ready;
  const message = 'Hello, World!';
  const hash = sodium.crypto_generichash(32, message);
  console.log({ hash });
})();

Digital Signatures

This feature allows you to create a digital signature for a message. The code generates a key pair and then signs the message 'Hello, World!' using the crypto_sign function.

const sodium = require('libsodium-wrappers-sumo');
(async() => {
  await sodium.ready;
  const { publicKey, privateKey } = sodium.crypto_sign_keypair();
  const message = 'Hello, World!';
  const signature = sodium.crypto_sign(message, privateKey);
  console.log({ signature });
})();

Other packages similar to libsodium-wrappers-sumo

Keywords

FAQs

Package last updated on 13 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc